/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dk.itu.samd.group2.tagapastry;

import java.io.IOException;
import java.util.Vector;

import rice.p2p.commonapi.rawserialization.OutputBuffer;
import dk.itu.samd.group2.tagapastry.messages.IndexMsg;

/**
 *
 * @author frgr
 */
public interface Index extends Iterable<IndexEntry> {

    public void insert(String object, String hash);

    public void remove(String object, String hash);
    
    public Vector<IndexEntry> getEntries();

    public int getSize();
    
    public Vector<IndexRelative> getChildren();
   
	public void decDelta();
	
	public void resetDelta();
	
	public boolean isDeltaChanged();
	
	public int getDelta();
	
	public void addToSizeOfSubtree(int delta);
	
	public void setEntries(Vector<IndexEntry> entries);
	
	public static enum State {
		RETRACTING,
		LEAF,
		PARENT,
		EMPTY_LEAF
	}
	
	public boolean bufferOrForward(IndexMsg msg);
	
	public void handleRetractionResponse(Vector<IndexEntry> entries, char childExtension);

	public void cleanDataInChild(char childExtension);
	
	public Tag getTag();

	public void serialize(OutputBuffer buf) throws IOException;

	public boolean isRoot();
	
	public boolean isEmpty();
	
	public int getIndexSize();
	
}
